Skip to content

"fraction" fixes - #4462

Open
pzinn wants to merge 6 commits into
Macaulay2:developmentfrom
pzinn:frac
Open

"fraction" fixes#4462
pzinn wants to merge 6 commits into
Macaulay2:developmentfrom
pzinn:frac

Conversation

@pzinn

@pzinn pzinn commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

This fixes two somewhat related bugs in the handling of fractions:

R=QQ[a,b]/(a*b-1)
1/a -- before: fails to realise it's b, after: gives b
lift(oo,R) -- before: fails to lift, after: lifts

basically, M2 did not correctly simplify the denominator when it was a unit, leading to lots of oddities (this is only the simplest example). now it does a much cleaner job.

AI disclosure

I formulated the fixes, but codex helped with the c++.

@pzinn pzinn changed the title "frac" fixes "fraction" fixes Jul 2, 2026
@d-torrance d-torrance added the Engine Macaulay2/e label Jul 2, 2026

@d-torrance d-torrance left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed with @local-ring. Just a couple questions and comments

Comment thread M2/Macaulay2/e/rings/frac.cpp
Comment thread M2/Macaulay2/e/rings/frac.cpp Outdated
Comment thread M2/Macaulay2/tests/normal/frac.m2
@d-torrance d-torrance linked an issue Jul 19, 2026 that may be closed by this pull request

@d-torrance d-torrance left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes! I have a few other suggestions. (Thanks to Claude 🤖 for suggesting a few things, too.)

Comment thread M2/Macaulay2/packages/LocalRings/tests.m2 Outdated
Comment thread M2/Macaulay2/e/rings/frac.cpp
Comment thread M2/Macaulay2/e/rings/frac.cpp Outdated
Comment thread M2/Macaulay2/e/rings/frac.cpp Outdated
Comment thread M2/Macaulay2/e/rings/frac.cpp Outdated
@pzinn

pzinn commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

all suggestions implemented. these are minimal fixes, e.g., for the example of #3973, M2 will output an error message instead of crashing; I have not tried to make it produce the actual inverse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Engine Macaulay2/e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error multiplying matrices with entries in fraction field

2 participants